﻿using System;
 
using CARMSBusiness;
using CARMSData.EntityClasses;

namespace CARMS.Admin
{
    public partial class DictionaryTypeCreate : PageBase
    {
        protected void Page_Load(object sender, EventArgs e){}
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            CloseWindow(false);
        }
        protected void btnSaveType_Click(object sender, EventArgs e)
        {
            if(txtTypeName.Text.Trim().Length==0)
            {
                base.Alert("Please input the type name!");
            }
            else
            {
                var entity = new DictionaryCategoryEntity();
                entity.Name= txtTypeName.Text.Trim();
                if (AdminBusiness.SaveDictionaryCategory(entity))
                {
                    CloseWindow(true);
                }
                else
                {
                    CloseWindow(false);
                }
            }
        }
    }
}
